{load header}
<!--/H-->

    <!-- 内容区 -->
    <div id="main-content">
        <div id="top-alert" class="fixed alert alert-error" style="display: none;">
            <button class="close fixed" style="margin-top: 4px;">&times;</button>
            <div class="alert-content">这是内容</div>
        </div>
        <div id="main" class="main">
        <!-- nav --><!-- nav -->
	<div class="main-title">
		<h2>文章管理</h2>
	</div>
	<div class="tab-wrap">
		<ul class="tab-nav nav">
			<li><a href="{eval echo site_url('community/index')}">文章列表</a></li>
			<li class="current"><a href="{eval echo site_url('community/articles_add')}">添加文章</a></li>
		</ul>
		
		<div class="tab-content">
			
	 <form action="" method="post" class="form-horizontal">
		<div class="form-item">
			<label class="item-label">文章分类<span class="check-tips"></span></label>
			<div class="controls inputtext">
                <select name="cat_id">
					<option value="">-请选择-</option>
					<!--{loop $catelist $val}-->
						<option value="{$val['id']}">{$val['name']}</option>
							<!--{loop $val['children'] $v}-->
							<option value="{$v['id']}">└{$v['name']}</option>
								<!--{loop $v['children'] $lastv}-->
								<option value="{$lastv['id']}">　└{$lastv['name']}</option>
								<!--{/loop}-->
							<!--{/loop}-->
					<!--{/loop}-->
				</select>
            </div>
		</div>
		<div class="form-item">
			<label class="item-label">文章标题<span class="check-tips">（用于前台显示的页面名称）</span></label>
			<div class="controls">
				<input type="text" class="text input-large" name="title" value="">
			</div>
		</div>
             	<div class="form-item">
			<label class="item-label">文章简介<span class="check-tips">（用于前台显示的文章简介）</span></label>
			<div class="controls">
                            <textarea style="width:398px;height:95px;padding: 2px 5px 0px 5px;color: #7C7878;" name="summary"></textarea>
			</div>
		</div>
		<div class="form-item">
			<label class="item-label">缩略图<span class="check-tips">（用于前台显示）</span></label>
			<div class="controls">
				<input type="file" id="upload_picture_cover_id">
				<input type="hidden" name="thumb" id="cover_id_cover_id"/>
				<div class="upload-img-box"></div>
			</div>
			<script type="text/javascript" src="{eval echo base_url()}static/uploadify/jquery.uploadify.min.js"></script>
			<script type="text/javascript">
			//上传图片
			/* 初始化上传插件 */
			$("#upload_picture_cover_id").uploadify({
				"height"          : 30,
				"swf"             : "{eval echo base_url()}static/uploadify/uploadify.swf",
				"fileObjName"     : "picture",
				"buttonText"      : "上传图片",
				"uploader"        : "http://static.tan66.com/upload/picture.html",
				//'formData' : {"action": "upload", "sid" : ""},
				"width"           : 120,
				'removeTimeout'	  : 1,
				'fileTypeExts'	  : '*.jpg; *.png; *.gif;',
				"onUploadSuccess" : uploadPicturecover_id,
				'onFallback' : function() {
					alert('未检测到兼容版本的Flash.');
				}
			});
			function uploadPicturecover_id(file, data){
				var data = $.parseJSON(data);
				var src = '';
				if(data.status){
					$("#cover_id_cover_id").val(data.id);
					src = data.url || '' + data.path
					$("#cover_id_cover_id").parent().find('.upload-img-box').html(
						'<div class="upload-pre-item"><img src="' + src + '"/></div>'
					);
				} else {
					updateAlert(data.info);
					setTimeout(function(){
						$('#top-alert').find('button').click();
						//$(that).removeClass('disabled').prop('disabled',false);
					},1500);
				}
			}
			</script>
		</div>
		<div class="form-item">
			<label class="item-label">文章内容<span class="check-tips">（文章详细内容）</span></label>
			<div class="controls">
				<label class="textarea">
					<textarea name="content"></textarea>
                    <input type="hidden" name="parse" value="0">
					<link rel="stylesheet" href="{eval echo base_url()}static/kindeditor/default/default.css" />
					<script charset="utf-8" src="{eval echo base_url()}static/kindeditor/kindeditor-min.js"></script>
					<script charset="utf-8" src="{eval echo base_url()}static/kindeditor/zh_CN.js"></script>
					<script type="text/javascript">
						var editor;
						KindEditor.ready(function(K) {
							editor = K.create('textarea[name="content"]', {
								allowFileManager : false,
								themesPath: K.basePath,
								width: '100%',
								height: '350px',
								resizeType: 1,
								pasteType : 2,
								urlType : 'absolute',
								//fileManagerJson : '/index.php?s=/admin/article/filemanagerjson.html',
								//uploadJson : '/index.php?s=/admin/article/uploadjson.html' }
								//uploadJson : '/index.php?s=/admin/addons/execute/_addons/editor_for_admin/_controller/upload/_action/ke_upimg.html'
							});
						});

						$(function(){
							//传统表单提交同步
							$('textarea[name="content"]').closest('form').submit(function(){
								editor.sync();
							});
							//ajax提交之前同步
							$('button[type="submit"],#submit,.ajax-post').click(function(){
								editor.sync();
							});
						})
					</script>
				</label>
			</div>
		</div>
		<div class="form-item">
            <label class="item-label">审核状态<span class="check-tips"></span></label>
            <div class="controls">
                <label class="radio"><input type="radio" checked name="status" value="0">未审核</label>
                <label class="radio"><input type="radio" name="status" value="1">审核通过</label>
                <label class="radio"><input type="radio" name="status" value="2">审核失败</label>
            </div>
        </div>
		
		
		
		<div class="form-item">
			<input type="hidden" name="id" value="">
			<button class="btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">确 定</button>
			<button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
		</div>
	</form>
	
		</div>
	</div>

<!--F-->{load footer}